/**
 * Author: w景洋.
 * Time: 2016/4/19 0019
 */
angular.module('entrance.service.auth', [
    "ngResource",
    "ngStorage"
])
    //认证服务
    .service('EntAuthService', ['$resource',function($resource){
        //获取所有订单
        this.getDelivery = function(){
            var getdeliveryBy = $resource(delivery+"delivery");
            return getdeliveryBy.query();
        };
        //通过订单id获取订单详情
        this.getDeliverybyid = function(dlvid){
            var getDeliveryById = $resource(delivery+"delivery/:dlvid");
            return getDeliveryById.get({dlvid:dlvid});
        };
        //通过商家id获取订单详情
        this.getDeliverybySplid = function(splid){
            var getDeliveryBysplid = $resource(delivery+"deliveryBysplid/:splid");
            return getDeliveryBysplid.query({splid:splid});
        };

        //通过派送员id获取订单详情
        this.getDeliverybyCourierid = function(courierid){
            var getDeliveryBycourierid = $resource(delivery+"deliveryBycourierid/:courierid");
            return getDeliveryBycourierid.query({courierid:courierid});
        };
        //
        this.getDelivery_goodsbyid = function(dlvid){
            var getDelivery_goodsById = $resource(delivery+"deliverygoods/:dlvid");
            return getDelivery_goodsById.query({dlvid:dlvid});
        };
        this.getDelivery_goods = function(){
            var getDelivery_goods = $resource(delivery+"deliverygoods");
            return getDelivery_goods.query();
        };
        this.getDelivery_Statusbyid = function(dlvid){
            var getDelivery_statusById = $resource(delivery+"deliverystatus/:dlvid");
            return getDelivery_statusById.query({dlvid:dlvid});
        };
        this.updataDelivery_Status = function(deliveryStatus,succ){
            var updataDelivery_status = $resource(delivery+"deliverystatus");
            return updataDelivery_status.save(deliveryStatus,succ);
        };
        //获取派送员
        this.getCourier = function(){
            var getCourier = $resource(delivery+"courier");
            return getCourier.query();
        };
        //根据派送员id载入派送单子
        this.updataDeliver = function(deliver,succ){
            var updataDeliver = $resource(delivery+"delivery/:dlvid");
            return updataDeliver.save({dlvid:deliver.dlvid},deliver,succ);
        };
    }])